home *** CD-ROM | disk | FTP | other *** search
/ Mac Mania 6 / MacMania 6.toast / / Tools&Utilities / TouchMe 1.2□ / touchMe 1.2 Folder / touchMe source codes / CW11 PP source / source / CTouchMeApp.h < prev    next >
Encoding:
Text File  |  1997-04-25  |  3.9 KB  |  121 lines  |  [TEXT/CWIE]

  1. // ==================================================
  2. //    CTouchMeApp.h
  3. //    Copyright (C) 1996-1997 Mizutori Tetsuya
  4. //    July 4, 1996; February 3, 1997; April 23, 1997.
  5. // ==================================================
  6. //    All documents are pretty-printed in 10-point Geneva font.
  7.  
  8. #pragma once
  9.  
  10. #include <LDocApplication.h>
  11.  
  12. #include "CTouchMeAppleEvents.h"
  13. #include "CTouchMePref.h"
  14.  
  15. class LWindow;
  16. class LArray;
  17. class CTouchMePref;
  18. class CAppleGuideFile;
  19.  
  20.  
  21. class    CTouchMeApp : public LDocApplication {
  22.  
  23. public:
  24.                     CTouchMeApp();
  25.     virtual             ~CTouchMeApp();
  26.  
  27.     // Save settings data to preferences file if 'OK' button is selected
  28.     virtual Boolean        ObeyCommand( CommandT inCommand, void * ioParam );
  29.     virtual void        FindCommandStatus( CommandT inCommand,
  30.                             Boolean & outEnabled, Boolean & outUsesMark,
  31.                             Char16 & outMark, Str255 outName );
  32.  
  33. protected:
  34.  
  35.     // Execute once when launched by receiving Finder's OpenApplication event
  36.     virtual void        StartUp();
  37.     // Execute every time whenever OpenDocument AppleEvent was received
  38.     // Do touch command, or fill date time stamp field if option-key is pressed
  39.     virtual void        OpenDocument( FSSpec * inMacFSSpec );
  40.     virtual void        ChooseDocument();
  41.     // Reset the working status every time when a series of execution has finished
  42.     virtual void        UseIdleTime( const EventRecord & inMacEvent );
  43.     // Override the procedure to make a patch for displaying "About..." dialog
  44.     virtual void        ShowAboutBox();
  45.  
  46.     // Application-spicific functions
  47.     LWindow *            MakeMainWindow( void );
  48.     void                HandleDocuments( void );
  49.  
  50.  
  51.     // My AppleEvent handlers for 'HandleXXX()' functions
  52.     virtual void        HandleAppleEvent(
  53.                             const AppleEvent    &    inAppleEvent,
  54.                             AppleEvent     &        outAEReply,
  55.                             AEDesc &            outResult,
  56.                             Int32            inAENumber );
  57.  
  58.     // For responding AppleScript commands;
  59.     // 'get prefs', 'set prefs', 'load prefs', 'save prefs', 'touch', 'fetch'
  60.     void                HandleGetPrefs( const AppleEvent &inAppleEvent,
  61.                             AppleEvent & outAEReply, AEDesc & outResult );
  62.  
  63.     void                HandleSetPrefs( const AppleEvent &inAppleEvent,
  64.                             AppleEvent & outAEReply, AEDesc & outResult );
  65.  
  66.     void                HandleLoadPrefs( const AppleEvent &inAppleEvent,
  67.                             AppleEvent & outAEReply, AEDesc & outResult );
  68.  
  69.     void                HandleSavePrefs( const AppleEvent &inAppleEvent,
  70.                             AppleEvent & outAEReply, AEDesc & outResult );
  71.  
  72.     void                HandleTouch( const AppleEvent &inAppleEvent,
  73.                             AppleEvent & outAEReply, AEDesc & outResult );
  74.  
  75.     void                HandleFetch( const AppleEvent &inAppleEvent,
  76.                             AppleEvent & outAEReply, AEDesc & outResult );
  77.  
  78.  
  79.     void                HandleGetPrefsSettings(
  80.                             AERecord &        ioAERecord,
  81.                             ETouchType        inTouchType,
  82.                             Boolean            toCreateNewAERecord        = true );
  83.  
  84.     void                HandleSetPrefsSettings(
  85.                             AERecord &        inAERecord,
  86.                             ETouchType        inTouchType );
  87.  
  88.     void                HandleFetchDateTime(
  89.                             AERecord &        ioAERecord,
  90.                             FSSpec &            inMacFSSpec,
  91.                             Boolean            toCreateNewAERecord        = true );
  92.  
  93.     // A patched call-back function for displaying colored alert dialog
  94.     static pascal Boolean    MyAlertPatch( DialogRef dialog, EventRecord * event,  short * item );
  95.  
  96. private:
  97.  
  98.     LWindow *            mMainWindow;        // Instance object of class 'CTouchMeMainWindow'
  99.  
  100.     LArray *            mFileArray;        // Instance object of file stack array
  101.  
  102.     CTouchMePref *        mPref;            // Instance object of class 'CTouchMePref'
  103.  
  104.     CAppleGuideFile *    mAppleGuideFile;    // Instance object of Apple Guide file
  105.  
  106.     static ModalFilterUPP    sAlertPatchProc;    // A patch for displaying colored alert dialog
  107.  
  108.     Boolean            mOpenApplication;    // true if launched by the OpenApplication event
  109.     Boolean            mOpenDocument;        // true if invoked by the OpenDocument event
  110.  
  111.     Boolean            mKeyModifier;        // Check the modifier key if pressed on "Open..." command
  112.     Boolean            mUpdatePref;        // true if settings must be reset by prefs data
  113.  
  114.     long                mCount;            // A counter of execution times in the series of document files
  115.  
  116.     Boolean            mIsCommandPeriod;    // true if cmd-period key is pressed
  117. };
  118.  
  119.  
  120. // end of definitions
  121.